# 查找两字典的相同点，比如相同的键，相同的值等

map_1 = {
    'x':1,
    'y':2,
    'z':3
}
map_2 = {
    'x':10,
    'b':2,
    'c':12
}

def demo_1():
    # 获取交集的keys
    print(map_1.keys() & map_2.keys())
    # 获取key在map_1不在map_2
    print(map_1.keys() - map_2.keys())
    # 获取交集的元素
    print(map_1.items() & map_2.items())

def demo_2():
    c = {key:map_1[key] for key in map_1.keys() - {'z', 'w'}}
    print(c)

if __name__ == '__main__':
    demo_1()
    demo_2()